package com.yhq.basic.design.singleton;

import java.io.Serializable;

/**
 * 单例模式
 * 懒汉式-双重检测
 *
 * @author hqyin
 * @date 2023/2/3 11:00 上午
 */
public class Singleton5 implements Serializable {
    private static Singleton5 INSTANCE;

    private Singleton5() {

    }

    public static synchronized Singleton5 getInstance() {
        if (INSTANCE == null) {
            synchronized (Singleton5.class) {
                if (INSTANCE == null) {
                    INSTANCE = new Singleton5();
                }
            }
        }
        return INSTANCE;
    }
}
